﻿using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Web;
using Newtonsoft.Json;

namespace Chire.ChireInter.School
{
    /// <summary>
    /// School_Del 的摘要说明
    /// </summary>
    public class School_Del : IHttpHandler
    {
        HttpContext contextWithBase;
        string id = "";
        public void ProcessRequest(HttpContext context)
        {
            context.Response.ContentType = "text/plain";
            contextWithBase = context;
            analysisInfo();
        }

        #region 验证信息
        public void analysisInfo()
        {
            if (contextWithBase.Request.Form.AllKeys.Contains("id"))
            {
                id = contextWithBase.Request.Form["id"];
            }

            mainManager();
        }
        #endregion

        #region 主要操作
        public void mainManager()
        {
            School_Action schoolAction = new School_Action();
            schoolAction.deleteSchoolWithId(id);
            scuccessedManager();
        }

        #endregion

        #region 成功方法
        public void scuccessedManager()
        {
            OUTSchool_List_Model out_base_setting = new OUTSchool_List_Model();
            out_base_setting.errCode = "200";
            out_base_setting.errMsg = "success";

            JsonSerializer serializer = new JsonSerializer();
            StringWriter sw = new StringWriter();
            serializer.Serialize(new JsonTextWriter(sw), out_base_setting);
            string info = sw.GetStringBuilder().ToString();
            contextWithBase.Response.Write(sw.GetStringBuilder().ToString());
        }
        #endregion

        #region 其他a
        public bool IsReusable
        {
            get
            {
                return false;
            }
        }
        #endregion
      
    }
}